package com.rpoonolly.simplegame.worldGrid;

import java.io.Serializable;

public final class GridCoordinate implements Serializable {
	private static final long serialVersionUID = 1L;
	
	private final int x;
	private final int y;
	
	public GridCoordinate(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}
	
	@Override
	public String toString() {
		return "x:" + x + ",\ty:" + y;
	}
	
	public boolean equals(GridCoordinate coord) {
		return x == coord.x && y == coord.y;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(!(obj instanceof GridCoordinate))
			return false;
		
		return equals((GridCoordinate) obj);
	}
	
	@Override
	public int hashCode() {
		return toString().hashCode();
	}
}
